﻿using System;

namespace HardcoreGame.Common.Helpers
{
    public class DelayedAction(int delayFrames, Action callback)
    {
        public int DelayFrames { get; set; } = delayFrames;
        public int ElapsedFrames { get; set; } = 0;
        public Action Callback { get; set; } = callback;
        public bool IsComplete { get; set; } = false;

        public void Update()
        {
            if (IsComplete) return;

            ElapsedFrames++;
            if (ElapsedFrames >= DelayFrames)
            {
                Callback?.Invoke();
                IsComplete = true;
            }
        }
    }
}
